package io;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class IOTest2 {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		File f1 = new File("E:/С˵/2txt");
		File f2 = new File("E:/2.txt");
		System.out.println(Thread.currentThread().getContextClassLoader()
				.getResource("./").getPath());
		BufferedReader fis = null;
		BufferedWriter bd = null;
		try {
			fis = new BufferedReader(new FileReader(f1));
			bd = new BufferedWriter(new FileWriter(f2));
			int len = 0;
			char[] c = new char[100];
			while ((len = fis.read(c, 0, 100)) >= 0) {
				bd.write(c, 0, len);
				System.out.print(c);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				if (fis != null)
					fis.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
			try {
				if (bd != null)
					bd.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

	}

}
